<admintpl file="header"/>
<link href="__PUBLIC__/js/cityPicker/css/city-picker.css" rel="stylesheet"/>
<style>
    .imgs {
        margin-left: 5px;
    }

    .display_none {
        display: none;
    }
</style>
</head>
<script type="text/html" id="photos-item-wrapper">
    <li id="savedimage{id}">
        <input id="photo-{id}" type="hidden" name="photos_url[]" value="{filepath}">
        <input id="photo-{id}-name" type="text" name="photos_alt[]" value="{name}" style="width: 160px;" title="图片名称">
        <img id="photo-{id}-preview" src="{url}" style="height:36px;width: 36px;"
             onclick="parent.image_preview_dialog(this.src);">
        <a href="javascript:upload_one_image('图片上传','#photo-{id}');">替换</a>
        <a href="javascript:$('#savedimage{id}').remove();">移除</a>
    </li>
</script>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:U('Information/lists')}" target="_self">信息列表</a></li>
        <li class="active"><a href="javascript:;">编辑</a></li>
    </ul>
    <form action="{:U('Information/edit')}" method="post" class="form-horizontal"
          enctype="multipart/form-data">
        <div class="row-fluid">
            <div class="span10">
                <table class="table table-bordered">

                    <tr>
                        <th style="white-space:nowrap;">标题：</th>
                        <td><input type="text" name="post[title]" required id="name" value="{$info.title}" style="width: 400px">
                            <input type="text" value="{$info.id}" name="id" class="hide">
                            <span class="form-required">*</span>
                        </td>
                    </tr>
                    <tr id="thirdparty" class="">
                        <th style="white-space:nowrap;">封面图：</th>
                        <td>
                            <input type="file" name="cover_photo" value="">
                             已保存封面：<img src="{$info.cover}?imageView2/2/w/60">
                        </td>
                    </tr>

                    <tr>
                        <th style="white-space:nowrap;">内容简介：</th>
                        <td><textarea rows="5" cols="30" name="post[discribe]" required value="">{$info.discribe}</textarea>
                            <span class="form-required">*</span>
                        </td>
                    </tr>
                    <tr>
                        <th>描述详情</th>
                        <td>
                            <script type="text/plain" id="content" name="post[content]"
                                    style="width:80%x;height:500px;"></script>
                        </td>
                    </tr>


                </table>
            </div>
        </div>
        <button class="btn btn-primary js-ajax-submit" type="submit">提交</button>
        <a class="btn" href="{:U('Information/lists')}">返回</a>
    </form>
</div>
</body>
<script src="__PUBLIC__/js/jquery.js"></script>
<script src="__PUBLIC__/js/common.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/content_addtop.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/ueditor/ueditor.all.min.js"></script>
<script>
    $(function () {
        var ue = UE.getEditor('content', {
            autoHeight: false,
            autoHeightEnabled: false, //出现滚动条
            elementPathEnabled: false  //去掉元素路径

        });
        //对编辑器的操作最好在编辑器ready之后再做
        ue.ready(function () {
            //设置编辑器的内容
            ue.setContent('{$info.content}');
            //获取html内容，返回: <p>hello</p>d
        });


        $('.thirdparty').click(function (e) {
            if ($("input[name='post[pro_shop_type]']:checked").val() == 2) {
                $('#thirdparty').removeClass('display_none');
            }
            else {
                $('#thirdparty').addClass('display_none');
                $('#thirdparty').val('');
            }
        });

    });

    function add() {
        var html = '<tr>' +
                '<td>' +
                '<input name="option_name[]" required type="text">' +
                '</td>' +
                '<td>' +
                '<input name="option_price[]" required type="text">' +
                '</td>' +
                '<td>' +
                '<input name="inventory[]" required type="text">' +
                '<img class="imgs" onclick="javascript:if($(\'#goods_attr\').find(\'tr\').length > 1){$(this).parent().parent().remove()};" style="width: 30px;height: 30px;" src="__PUBLIC__/images/reduce.png"></td>';

        $("#goods_attr").append(html);
    }

</script>
</html>